  <template>
  <el-form :model="form" ref="form" status-icon :rules="rules" label-width="80px" :inline="false" size="normal">
    <el-form-item v-for="(item,index) in formLabel" :key="index" :label="item.label" :prop="item.prop">
      <el-input
        v-model="form[item.prop]"
        :placeholder="'请输入'+item.label"
        :disabled="item.disabled"
      >
      </el-input>
    </el-form-item>
    <el-form-item v-if="addUserInfo">
      <el-button @click="cancel">取消</el-button>
      <el-button type="primary" @click="addUserInfo">确定</el-button>
    </el-form-item>
    <el-form-item v-if="editUserInfo">
      <el-button @click="cancel">取消</el-button>
      <el-button type="primary" @click="editUserInfo">确定</el-button>
    </el-form-item>
  </el-form>
</template>

<script>
export default {
  name: 'Form',
  data () {
    return {
    }
  },
  props: {
    formLabel: Array,
    form: Object,
    rules: Object,
    addUserInfo: Function,
    editUserInfo: Function
  },
  methods: {
    cancel () {
      this.$refs.form.resetFields()
    }
  }
}
</script>

<style>

</style>
